package Main;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.util.Random;

/**
 *
 * @author Alvis
 */
public class Game {

	public static Random RANDOM = new Random(System.currentTimeMillis());
	public GameState gameState;
	private int width;
	private int height;
	public boolean isExit = false;

	public int getHeight() {
		return height;
	}

	public int getWidth() {
		return width;
	}

	public Game(int w, int h) {
		width = w;
		height = h;
		gameState = new WaitingState(this);

	}

	protected void showScene(GameState scene) {
		gameState = scene;
	}

	public void setSize(int w, int h) {
		width = w;
		height = h;
	}

	public void update(float t) {
		showScene(gameState);
		gameState.update(t);
	}

	public void draw(Graphics2D g) {

		gameState.draw(g);

	}

	public void keyPressed(KeyEvent e) {

		gameState.keyPressed(e);

	}

	public void keyReleased(KeyEvent e) {
		if (gameState != null) {
			gameState.keyReleased(e);
		}
	}

	public void mouseDragged(MouseEvent e) {

		gameState.mouseDragged(e);

	}

	public void mouseMoved(MouseEvent e) {

		gameState.mouseMoved(e);

	}

	public void mousePressed(MouseEvent e) {

		gameState.mousePressed(e);

	}

	public void mouseReleased(MouseEvent e) {

		gameState.mouseReleased(e);

	}
}
